<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>
<%@include file="../includes/header.jsp"%>

<h2 class="title">Edit a user</h2>
<p class="meta">Login : <s:property value="%{u.login}" /></p>
<s:div cssClass="entry">
	<s:form action="editUserEnd">
		<s:actionerror />
		<s:actionmessage />
		<s:textfield name="u.login" value="%{u.login}" label="Login"
			readonly="true" cssClass="grey" />
		<s:textfield name="u.password" value="%{u.password}" label="Password"
			required="true" maxlength="50" />
		<s:textfield name="u.lastname" value="%{u.lastname}" label="Last name"
			required="true" maxlength="50" />
		<s:textfield name="u.firstname" value="%{u.firstname}"
			label="First name" required="true" maxlength="50" />
		<s:textfield name="u.mail" value="%{u.mail}" label="Mail"
			required="true" maxlength="50" />
		<s:select name="code" label="Favorite currency" list="currencies"
			listKey="code" listValue="name" required="true"
			value="%{u.favoriteCurrency.code}" />
		<s:if test="#session.user.admin">
			<s:checkbox name="u.admin" value="%{u.admin}" label="Admin" />
		</s:if>
		<s:else>
			<s:hidden name="u.admin" value="%{u.admin}" />
		</s:else>
		<s:hidden name="login" value="%{u.login}" />
		<s:submit value="Edit" action="editUserEnd" align="center" />
	</s:form>
	<s:if test="#session.user.admin">
		<s:url action="users" var="users" includeParams="get" />
		<s:a href="%{users}">Retour</s:a>
	</s:if>
</s:div>

<%@include file="../includes/footer.jsp"%>
